#ifndef _ESP_H
#define _ESP_H

/* Includes ------------------------------------------------------------------*/

/* USER CODE BEGIN Includes */
#include "stm32f1xx_hal.h"
#include "string.h"
#include "stdlib.h"
#include "usart.h"
#include "delay.h"
/* USER CODE END Includes */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */

#define SSID "P2P"
#define PASS "123123123m"

#define IOT_DOMAIN_NAME "116.62.131.51"
#define IOT_PORTNUM "6050"

#define WIFI_RX_STA USART3_RX_STA
#define WIFI_RX_BUF USART3_RX_BUF

/* USER CODE END Private defines */


/* USER CODE BEGIN Prototypes */
typedef enum {
    WIFI_CONNECTING,
    WIFI_CONNECTED,
    WIFI_DISCONNECTED,
    WIFI_TIMEOUT
} NetworkState_typedef;

extern u8 G_wifi_status;

uint8_t esp8266_send_cmd(char *cmd, char *ack, uint16_t waittime);

uint8_t *esp8266_check_cmd(char *str);

uint8_t esp8266_quit_trans(void);

void esp8266_smartConfig(void);

void esp8266_after_wifi_connected(void);

void ESP8266_Clear(void);

void esp8266_init(void);

void autoConnectWifi(void);

uint8_t esp8266_Connect_AP();

uint8_t esp8266_Connect_Server(char *host, char *port);

uint8_t esp8266_Connect_IOTServer(void);
/* USER CODE END Prototypes */
#endif
